package keys

import (
	"fmt"
	commonKeys "gitee.com/igolang/imoney/internal/common/keys"
	"time"
)

func Config(in string) *commonKeys.Key {
	return commonKeys.Config(in)
}

func DictData(in string) *commonKeys.Key {
	return commonKeys.DictData(in)
}

func Captcha(id string) *commonKeys.Key {
	return &commonKeys.Key{
		Key:    prefix("capt:" + id),
		Expire: 10 * time.Minute,
	}
}

func LoginUser(uid int64) *commonKeys.Key {
	return &commonKeys.Key{
		Key: prefix(fmt.Sprintf("login:user:%d", uid)),
	}
}

func UserToken(in string) *commonKeys.Key {
	return &commonKeys.Key{
		Key: prefix("token:" + in),
	}
}

func UserLoginErr(name string) *commonKeys.Key {
	return &commonKeys.Key{
		Key: prefix("login:err:" + name),
	}
}

func prefix(key string) string {
	return "sys:" + key
}
